class BadTemperature extends Exception {
	BadTemperature() {
	}
	
	BadTemperature(String reason) {
		super(reason);
	}
}

class TooHot extends BadTemperature {
	TooHot() {
		super("Default: too hot");
	}
	TooHot(String message) {
		super(message);
	} 
}

class TooCold extends BadTemperature {
	TooCold() {
		super("Default: too cold");
	}
	TooCold(String message) {
		super(message);
	}
}

class TemperatureObject {
	double temperature;
	
	TemperatureObject() {}
	TemperatureObject(double temp) {
		temperature = temp;
	}
	
	public void test() throws BadTemperature {
		if(temperature > 70) {
			throw new TooHot("It's too hot.");
		}
		else if(temperature < 20) {
			throw new TooCold("It's too cold.");
		}
		else {
			System.out.println("Everything is fine.");
		}
	}
}


public class TestTemperature {
	
	public static void testTemp(TemperatureObject t) {
		try{
			t.test();
		}catch(BadTemperature e) {
			System.out.println(e.getMessage());
		}
	}
	public static void main(String[] args){
		testTemp(new TemperatureObject(10));
		testTemp(new TemperatureObject(30));
		testTemp(new TemperatureObject(100));
		System.out.println("Add One !");
	}
}
